<?php  namespace Common\Model;
use Hdphp\Model\Model;
class GoodsList extends Model{
    protected $table = 'goods_list';
    public function store(){
    	if(!$this->create()) return false;

    	$combo=implode(',',Q('post.combo'));
    	$goods_gid=Q('post.goods_gid');
    	$comboData=$this->where("goods_gid={$goods_gid}")->pluck('combo');
        // p($comboData);
    	$this->data['combo']=$combo;
       $oldCombo=$this->where("goods_gid={$goods_gid} AND combo = '$comboData'")->get();
        // if($oldCombo){
        //     $this->error="货品不可重复填写";
        //     return false;
        // }
        // if()
    	$glid=$this->add();

    	return $glid;
    }
    public function edit(){
        if(!$this->create()) return false;
        $combo=implode(',',Q('post.combo'));
        p($combo);
        $this->data['combo']=$combo;
        $this->save();
        return true;
    }
}